import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Dummy here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Dummy extends Attachable
{
    /**
     * Act - do whatever the Dummy wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    boolean init = false;
    boolean toDestroy = false;
    int preX=0;
    int preY=0;
    public Dummy(GreenfootImage i, double rot){
        super(5, i);
    
        setImage(i);
        rotation = rot;
    }
    
    public void act() 
    {
        if(!init){
            setCoords(getX()-Play.getTrueX(), getY()-Play.getTrueY());
            init = true;
        }
        super.act();
        if((preX == getX()) || (preY == getY()) ){
        toDestroy = true;
        }else{
         preX = getX();
         preY = getY();
       }
       if(toDestroy){
        getWorld().removeObject(this);
        }
    }    
}
